package com.woniu.command.materialClassificationTypeCommand;

import com.woniu.command.Command;
import com.woniu.command.handler.MaterialClassificationTypeCommandHandler;
import com.woniu.outlet.po.MaterialClassificationTypePo;
import com.woniu.utils.ApplicationContextHolder;

public class AddMaterialClassificationTypeCommand implements Command<MaterialClassificationTypePo, Integer> {

    private MaterialClassificationTypeCommandHandler handler;

    public AddMaterialClassificationTypeCommand() {
        //ApplicationContextHolder.getApplicationContext()拿到ApplicationContext
        this.handler = ApplicationContextHolder.getApplicationContext()
                .getBean(MaterialClassificationTypeCommandHandler.class);
    }

    @Override
    public Integer execute(MaterialClassificationTypePo materialClassificationTypePo) {
        return this.handler.addMaterialClassificationType(materialClassificationTypePo);
    }
}
